{extend name="public/base" /}
{block name='content'}
{include file='public/content_header' /}
<!--数据列表页面-->
<section class="content">

    <!--顶部搜索筛选-->
    <div class="row">
        <div class="col-md-12">
            <div class="box">
                <div class="box-body">
                    <form class="form-inline searchForm" id="searchForm" action="{:url('index')}" method="GET">

                        <div class="form-group" style="padding-top: 3px;">
                            <input value="{$member_id ? $member_id : '' ;}"
                                   name="member_id" id="member_id" class="form-control input-sm"
                                   placeholder="用户融云ID搜索">
                        </div>
<!--                        <div class="form-group" style="padding-top: 3px;">-->
<!--                            <input value="{$me_uid ? $me_uid : '' ;}"-->
<!--                                   name="me_uid" id="me_uid" class="form-control input-sm"-->
<!--                                   placeholder="用户UID搜索">-->
<!--                        </div>-->
                        <div class="form-group" style="padding-top: 3px;">
                            <input value="{$me_phone ? $me_phone : '' ;}"
                                   name="me_phone" id="me_phone" class="form-control input-sm"
                                   placeholder="用户手机号/昵称搜索">
                        </div>
                        <div class="form-group" style="padding-top: 3px;">
                            <select name="me_sex" id="me_sex" class="form-control input-sm index-search">
                                <option value="">-用户性别-</option>
                                <option value="1"{if isset($me_sex) && $me_sex=='1'}selected{/if}>男</option>
                                <option value="2"{if isset($me_sex) && $me_sex=='2'}selected{/if}>女</option>
                            </select>
                        </div>
                        <div class="form-group" style="padding-top: 3px;">
                            <input value="{$order_number ? $order_number : '' ;}"
                                   name="order_number" id="order_number" class="form-control input-sm"
                                   placeholder="提现订单号搜索">
                        </div>
                        <div class="form-group" style="padding-top: 3px;">
                            <select name="status" id="status" class="form-control input-sm index-search">
                                <option value="">-审核状态-</option>
                                <option value="0"{if isset($status) && $status=='0'}selected{/if}>待审核</option>
                                <option value="1"{if isset($status) && $status=='1'}selected{/if}>通过提现</option>
                                <option value="2"{if isset($status) && $status=='2'}selected{/if}>拒绝提现</option>
                            </select>
                        </div>
                        <div class="form-group" style="padding-top: 3px;">
                            <select name="sk_type" id="sk_type" class="form-control input-sm index-search">
                                <option value="">-收款类型-</option>
                                <option value="3"{if isset($sk_type) && $sk_type=='3'}selected{/if}>银行卡</option>
                                <option value="2"{if isset($sk_type) && $sk_type=='2'}selected{/if}>支付宝</option>
                                <option value="1"{if isset($sk_type) && $sk_type=='1'}selected{/if}>微信</option>
                            </select>
                        </div>
                        <div class="form-group" style="padding-top: 3px;">
                            <select name="is_pending" id="is_pending" class="form-control input-sm index-search">
                                <option value="">-待定标签-</option>
                                <option value="1"{if isset($is_pending) && $is_pending=='1'}selected{/if}>已设置</option>
                                <option value="0"{if isset($is_pending) && $is_pending=='0'}selected{/if}>未设置</option>
                            </select>
                        </div>
<!--                        <div class="form-group" style="padding-top: 3px;">-->
<!--                            <select name="is_pass_withdrawal" id="is_pass_withdrawal" class="form-control input-sm index-search">-->
<!--                                <option value="">-免审核-</option>-->
<!--                                <option value="1"{if isset($is_pass_withdrawal) && $is_pass_withdrawal=='1'}selected{/if}>已开启</option>-->
<!--                                <option value="0"{if isset($is_pass_withdrawal) && $is_pass_withdrawal=='0'}selected{/if}>未开启</option>-->
<!--                            </select>-->
<!--                        </div>-->
                        <div class="form-group" style="padding-top: 3px;width: 16%;">
                            <input style="width: 100%" value="{$add_time|default=''}" readonly name="add_time" id="add_time"
                                   class="form-control input-sm indexSearchDateRange" placeholder="提现时间搜索">
                        </div>
                        <script>
                            laydate.render({
                                elem: '#add_time',
                                type: 'datetime',
                                range: true,
                            });
                        </script>

                        <div class="form-group" style="padding-top: 3px;">
                            <input value="{$f_member_id ? $f_member_id : '' ;}"
                                   name="f_member_id" id="f_member_id" class="form-control input-sm"
                                   placeholder="上级用户融云ID搜索">
                        </div>

                        <div class="form-group" style="padding-top: 3px;">
                            <button class="btn btn-sm btn-primary" type="submit"><i class="fa fa-search"></i> 查询
                            </button>
                        </div>

                        <div class="form-group">
                            <button onclick="exportData('index.html')" class="btn btn-sm btn-warning exportData" type="button"> 银行卡导出
                            </button>
                        </div>
                        <div class="form-group">
                            <button onclick="exportDatatwo('index.html')" class="btn btn-sm btn-warning exportData" type="button"> 支付宝导出
                            </button>
                        </div>

                        <div class="form-group" style="padding-top: 3px;">
                            <button onclick="clearSearchForm()" class="btn btn-sm btn-default" type="button"><i
                                    class="fa  fa-eraser"></i> 清空查询
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="box">

                <!--数据列表顶部-->
                <div class="box-header" style="    margin-bottom: -32px;">
                    <div>
                        <a class="btn btn-success btn-sm ReloadButton" data-toggle="tooltip" title="刷新">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <b>【总提现待审核（不包含手续费）：{$dsh_money} 元】 【总提现通过（不包含手续费）：{$tg_money} 元】 【总提现拒绝（不包含手续费）：{$jj_money} 元】</b>


                        <input name="sh_content" id="sh_content" class="form-control input-sm" placeholder="批量通过理由" style="margin-top: 10px; width: 35%;">
                        <a style="margin-top: -52px;margin-left: 36%;"  class="btn btn-success btn-sm ktAjaxButton" data-toggle="tooltip" title=""
                           data-confirm-title="是否确认" data-confirm-content="是否将 选中的提现订单，批量设置为【通过提现】？"
                           data-id="checked"
                           data-url="{:url('actionpltg')}">
                            <i class="fa fa-circle"></i> 批量通过
                        </a>


                    </div>
                </div>

                <div class="box-body table-responsive">
                    <table class="table table-hover table-bordered datatable" width="100%">
                        <thead>
                        <tr style="white-space: nowrap">
                            <td style="text-align: center;vertical-align: middle;">
                                <input id="dataCheckAll" type="checkbox" onclick="checkAll(this)" class="checkbox"
                                       placeholder="全选/取消">
                            </td>
                            <th style="text-align: center;vertical-align: middle;width: 5%">提现ID</th>
                            <th style="text-align: center;vertical-align: middle;width: 15%">提现用户信息</th>
<!--                            <th style="text-align: center;vertical-align: middle;width: 5%">免审核</th>-->
<!--                            <th style="text-align: center;vertical-align: middle;width: 15%">手机号 / 性别</th>-->
                            <th style="text-align: center;vertical-align: middle;width: 5%">备注姓名</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">状态</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">可提 / 不可提</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">真实姓名</th>
<!--                            <th style="text-align: center;vertical-align: middle;width: 5%">提现订单号</th>-->
                            <th style="text-align: center;vertical-align: middle;width: 15%">上級用户</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">顶级用户</th>
<!--                            <th style="text-align: center;vertical-align: middle;width: 15%">上上级用户信息</th>-->
                            <th style="text-align: center;vertical-align: middle;width: 5%">提现数 / 手续费</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">实际到账</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">当时剩余</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">收款类型</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">收款信息</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">提现时间</th>
                            <th style="text-align: center;vertical-align: middle;width: 5%">审核状态</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">处理时间</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">审核备注</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">待定标签</th>
                            <th style="text-align: center;vertical-align: middle;width: 10%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name='data' id='item' key='data_key'}

                        {if $item.tr_color==0}
                        <tr>
                        {/if}
                        {if $item.tr_color==1}
                        <tr style="background-color: burlywood">
                        {/if}
                        {if $item.tr_color==2}
                        <tr style="background-color: aqua">
                        {/if}
                        {if $item.tr_color==3}
                        <tr style="background-color: aquamarine">
                        {/if}


                            {if $item.status==0}
                                <td style="text-align: center;vertical-align: middle;">
                                    <input type="checkbox" onclick="checkThis(this)" name="data-checkbox"
                                           data-id="{$item.id}" class="checkbox data-list-check" value="{$item.id}"
                                           placeholder="选择/取消">
                                </td>
                            {/if}
                            {if $item.status!=0}
                            <td style="text-align: center;vertical-align: middle;">
                                -
                            </td>
                            {/if}

                            <td style="text-align: center;vertical-align: middle;">{$item.id}</td>
                            <td style="text-align: center;vertical-align: middle;">【融云ID：{$item.member_id}】【昵称：{$item.me_nick_name}】【性别：{$item.me_sex_word}】</td>

<!--                            {if $item.is_pass_withdrawal==0}-->
<!--                            <td style="text-align: center;vertical-align: middle;">{$item.is_pass_withdrawal_word}-->
<!--                                <a class="btn btn-success btn-xs AjaxButton" data-toggle="tooltip" title="为此用户开通【提现免审核】功能"-->
<!--                                   data-id="{$item.member_id}" data-confirm-title="为此用户开通【提现免审核】功能确认"-->
<!--                                   data-confirm-content='您确定要为融云ID为<span class="text-red">{$item.member_id}</span> 的用户开通【提现免审核】功能吗？？'-->
<!--                                   data-url="{:url('setpassmsh?index=1')}">-->
<!--                                    <i class="fa fa-circle"></i>-->
<!--                                </a>-->
<!--                            </td>-->
<!--                            {else/}-->
<!--                            <td style="text-align: center;vertical-align: middle;"><span style="color: green">{$item.is_pass_withdrawal_word}</span>-->
<!--                                <a class="btn btn-warning btn-xs AjaxButton" data-toggle="tooltip" title="关闭此用户【提现免审核】功能"-->
<!--                                   data-id="{$item.member_id}" data-confirm-title="关闭此用户【提现免审核】功能确认"-->
<!--                                   data-confirm-content='您确定关闭融云ID为<span class="text-red">{$item.member_id}</span> 的用户【提现免审核】功能吗？？'-->
<!--                                   data-url="{:url('setpassmsh?index=0')}">-->
<!--                                    <i class="fa fa-circle"></i>-->
<!--                                </a>-->
<!--                            </td>-->
<!--                            {/if}-->

<!--                            <td style="text-align: center;vertical-align: middle;">【手机号：{$item.me_phone}】【性别：{$item.me_sex_word}】</td>-->
                            <td style="text-align: center;vertical-align: middle;">{$item.bz_name}
                                <a data-id="{$item.member_id}" data-width="700px" data-height="350px" data-url="setbzname" data-confirm="2" data-type="2"
                                   class="btn btn-warning btn-xs AjaxButton"  title="为此用户设置备注姓名" data-toggle="tooltip">
                                    设置
                                </a>
                            </td>
                            <td style="text-align: center;vertical-align: middle;">{$item.me_status_word}</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.stamp_money} / {$item.no_stamp_money}</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.me_realname}</td>
<!--                            <td style="text-align: center;vertical-align: middle;">{$item.order_number}</td>-->

                            {if $item.f_member_id==0}
                            <td style="text-align: center;vertical-align: middle;">无上级</td>
                            {else/}
                            <td style="text-align: center;vertical-align: middle;">【{$item.f_member_id}】【昵称：{$item.f_me_nick_name}】</td>
                            {/if}

                            <td style="text-align: center;vertical-align: middle;">{$item.dj_member_word}
                                {if $item.dj_member_id != 0}
                                <a data-id="{$item.dj_member_id}" data-width="700px" data-height="350px" data-url="setbzname" data-confirm="2" data-type="2"
                                   class="btn btn-warning btn-xs AjaxButton"  title="为此顶级用户设置备注姓名" data-toggle="tooltip">
                                    设置
                                </a>
                                {/if}
                            </td>

                            <td style="text-align: center;vertical-align: middle;">{$item.total_withdrawal} / {$item.fee_withdrawal}（{$item.fee_bl}%）</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.actual_withdrawal} 元</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.after_money_word}</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.sk_type_word}</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.sk_type_info}</td>
                            <td style="text-align: center;vertical-align: middle;">{$item.add_time}</td>
                            <td style="text-align: center;vertical-align: middle;">
                                {if $item.status==0}
                                <span style="color: blue">{$item.status_word}</span>
                                {/if}
                                {if $item.status==1}
                                <span style="color: green">{$item.status_word}</span>
                                {/if}
                                {if $item.status==2}
                                <span style="color: red">{$item.status_word}</span>
                                {/if}
                            </td>
                            <td style="text-align: center;vertical-align: middle;">{$item.operation_time}</td>
                            <td style="text-align: center;vertical-align: middle;" title="{$item.content}">{$item.content_sl}</td>

                            {if $item.status==0}
                            <td style="text-align: center;vertical-align: middle;">{$item.is_pending_word}
                                {if $item.is_pending==0}
                                <a class="btn btn-success btn-xs AjaxButton" data-toggle="tooltip" title="为此条提现记录设置【待定标签】"
                                   data-id="{$item.id}" data-confirm-title="为此条提现记录设置【待定标签】标签确认"
                                   data-confirm-content='您确定要为记录ID为<span class="text-red">{$item.id}</span> 的提现记录设置【待定标签】吗？？'
                                   data-url="{:url('setpending?index=1')}">
                                    <i class="fa fa-circle"></i>
                                </a>
                                {/if}
                                {if $item.is_pending==1}
                                <a class="btn btn-warning btn-xs AjaxButton" data-toggle="tooltip" title="为此条提现记录取消【待定标签】"
                                   data-id="{$item.id}" data-confirm-title="取消此用户【同城页女孩】身份确认"
                                   data-confirm-content='您确定取消记录ID为<span class="text-red">{$item.id}</span> 的提现记录设置【待定标签】吗？？'
                                   data-url="{:url('setpending?index=0')}">
                                    <i class="fa fa-circle"></i>
                                </a>
                                {/if}
                            </td>
                            {else/}
                            <td style="text-align: center;vertical-align: middle;">-</td>
                            {/if}

                            <td style="text-align: center;vertical-align: middle;">
                                {if $item.status==0}
                                    {if $item.is_pending==0}
                                        {if $item.me_status==1}
                                            <a data-id="{$item.id}" data-url="passwithdraw" data-confirm="2" data-type="2"
                                               class="btn btn-success btn-xs AjaxButton"  title="通过用户的提现申请" data-toggle="tooltip">
                                                通过提现
                                            </a>
                                        {/if}

                                        <a data-id="{$item.id}" data-url="refusewithdraw" data-confirm="2" data-type="2"
                                           class="btn btn-danger btn-xs AjaxButton"  title="拒绝用户的提现申请" data-toggle="tooltip">
                                            拒绝提现
                                        </a>
                                    {else/}
                                        已设置待定
                                    {/if}
                                {else/}
                                    -
                                {/if}
                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>

                <!-- 数据列表底部 -->
                <div class="box-footer">
                    {$page|raw}
                    <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;">
                        <small>共{$total}条记录</small>&nbsp;
                        <small>每页显示</small>
                        &nbsp;
                        <select class="input-sm" onchange="changePerPage(this)">
                            <option value="10" {if $admin.per_page==10}selected{/if}>10</option>
                            <option value="20" {if $admin.per_page==20}selected{/if}>20</option>
                            <option value="30" {if $admin.per_page==30}selected{/if}>30</option>
                            <option value="50" {if $admin.per_page==50}selected{/if}>50</option>
                            <option value="100" {if $admin.per_page==100}selected{/if}>100</option>
                        </select>
                        &nbsp;
                        <small>条记录</small>
                    </label>
                </div>

            </div>
        </div>
    </div>
</section>
<script>
    $(function () {
        $('.photo-list img').on('click', function () {
            layer.photos({
                photos: '.photo-list',
                shadeClose: false,
                closeBtn: 2,
                anim: 5
            });
        })
    });



        $('body').on('click', '.ktAjaxButton', function (event) {
        console.log("ktAjax")
        event.preventDefault();

        if (adminDebug) {
        console.log('AjaxButton clicked.');
    }
        //是否弹出提示
        let layerConfirm = $(this).data("confirm") || 1;
        //访问方式，1为直接访问，2为layer窗口显示
        let layerType = parseInt($(this).data("type") || 1);
        //访问的url
        let url = $(this).data("url");
        //访问方式，默认post
        let layerMethod = $(this).data("method") || 'post';
        //访问成功后跳转的页面，不设置此参数默认根据后台返回的url跳转
        // let go = $(this).data("go") || 'url://reload';
        let go = 'url://reload';

        //当为窗口显示时可定义宽度和高度
        let layerWith = $(this).data("width") || '80%';
        let layerHeight = $(this).data("height") || '60%';

        //窗口的标题
        let layerTitle = $(this).data('title');

        //当前操作数据的ID
        let dataId = $(this).data("id");

        let dataData;
        //如果没有定义ID去查询data-data属性
        if (dataId === undefined) {
        dataData = $(this).data("data") || {};
    } else {
        if (dataId === 'checked') {
        if (dataSelectIds.length === 0) {
        layer.msg('请选择要操作的数据', {icon: 2, scrollbar: false,});
        return false;
    }
        dataId = dataSelectIds;
    }

        dataData = {
        "id": dataId,
        "sh_content": $("#sh_content").val(),
    };
    }

        if (typeof (dataData) != 'object') {
        dataData = JSON.parse(dataData);
    }

        /*需要确认操作*/
        if (parseInt(layerConfirm) === 1) {
        //提示窗口的标题
        let confirmTitle = $(this).data("confirmTitle") || '操作确认';
        //提示窗口的内容
        let confirmContent = $(this).data("confirmContent") || '您确定要执行此操作吗?';
        layer.confirm(confirmContent, {title: confirmTitle, closeBtn: 1, icon: 3}, function () {
        //如果为直接访问
        if (layerType === 1) {
        ajaxRequests(url, layerMethod, dataData, go);
    } else if (layerType === 2) {
        //如果为打开窗口
        //先进行权限查询
        if (checkAuth(url)) {
        layer.open({
        type: 1,
        area: [layerWith, layerHeight],
        title: layerTitle,
        closeBtn: 1,
        shift: 0,
        content: url + "?request_type=layer_open&" + parseParam(dataData),
        scrollbar: false,
    });
    }
    }
    });
    } else {
        //不需要操作确认
        if (layerType === 1) {
        //直接请求
        ajaxRequests(url, layerMethod, dataData, go);
    } else if (layerType === 2) {
        //弹出窗口
        //检查权限
        if (checkAuth(url)) {
        //用窗口打开
        layer.open({
        type: 2,
        area: [layerWith, layerHeight],
        title: layerTitle,
        closeBtn: 1,
        shift: 0,
        content: url + "?request_type=layer_open&" + parseParam(dataData),
        scrollbar: false,
    });
    }
    }
    }
    });

        function ajaxRequests(url, method, data, go) {
        let loadT = layer.msg('正在请求,请稍候…', {icon: 16, time: 0, shade: [0.3, '#000'], scrollbar: false,});
        $.ajax({
        url: url,
        dataType: 'json',
        type: method,
        data: data,
        success: function (result) {
        // debugger
        layer.close(loadT);
        layer.msg(result.msg, {
        icon: result.code ? 1 : 2,
        scrollbar: false,
    });

        if (adminDebug) {
        console.log('request success!');
        if (result.code === 1) {
        console.log('%cresult success', ';color:#00a65a');
            go = 'url://reload';
    } else {
        console.log('%cresult fail', ';color:#f39c12');
        go = 'url://reload';
    }
        setTimeout(function () {
        goUrl(go);
    }, 2000);
    }
        // setTimeout("alert('123')", 3000 )

    },
        error: function (xhr, type, errorThrown) {
        console.log("error")
        //异常处理；
        if (adminDebug) {
        console.log('%crequest fail!', ';color:#dd4b39');
        console.log();
        console.log("type:" + type + ",readyState:" + xhr.readyState + ",status:" + xhr.status);
        console.log("url:" + url);
        console.log("data:");
        console.log(data);
        layer.close(loadT);
    }
        layer.msg('访问错误,代码' + xhr.status, {icon: 2, scrollbar: false,});
    }
    }
        );
    }


</script>
{/block}

